#!/usr/bin/env /usr/local/python3
# -*- coding: utf-8 -*-

# pip install opencv-contrib-python
import cv2
import numpy as np

"""
解析验证探针数据
"""

__author__ = "hubert"


if __name__ == '__main__':
    # 读取视频文件
    cap = cv2.VideoCapture("http://file.seeingtv.com/targetPath/20210909/630b007838270c9a2c4d8443d203f910.ts")

    #读帧
    ret, frame = cap.read()
    i = 0
    while ret:

      ret, frame = cap.read()
      print(cap.get(0))  #cap.get(0) 视频文件的当前位置（播放）以毫秒为单位
      # """
      if ret:
          # 可调整视频窗大小
          cv2.namedWindow("Frame", cv2.WINDOW_NORMAL)
          # 设置视频窗默认大小
          cv2.resizeWindow("Frame", 640, 480);
          # 显示视频窗
          cv2.imshow("Frame", frame)
      # """
      if cv2.waitKey(1) & 0xFF == ord('q'):
          break
      i = i + 1
      if i%40 == 0:
          #print(i)
          cv2.imwrite('C:\\home\\save\\'+str(i)+'.png', frame)
    cv2.destroyAllWindows()
    cap.release()




